/********************************************************************
 
 Copyright (C), 2012年 dhc. All rights reserved.
 
 Filename: 	    MailMessageComposer.h
 
 Author:        muzongcun
 
 Version:       1.0
 
 Description:   MailMessageComposer
 
 History:
 
 muzongcun    2012/3/10     1.0     Create
 
 *********************************************************************/

#import <UIKit/UIKit.h>
#import "MailFriendList.h"
#import "MailCCFriendList.h"
#import "MailMsgReceiverView.h"
#import "MailCCMsgReceiverView.h"
#import "MailComm.h"
/*
 前向引用mail详细
 */
@class MailDetailMessage;


/*
 增加／删除人员列表
 */
enum  
{
	MSGV_DEL_CONTACT,
	MSGV_ADD_CONTACT
};

@interface MailMessageComposer : UIViewController <UITableViewDelegate,UITableViewDataSource,UITextFieldDelegate,UITextViewDelegate,MailFriendListDelegate,MailCCFriendListDelegate,MailMsgReceiverDelegate,MailCCMsgReceiverDelegate>
{
	UITableView *           m_mainView;
	UINavigationBar *       m_navBar;                 //自己创建
	UITextView *            m_contentTView;
    
    UILabel*                m_barTitleLabel;          //撰写邮件的标题
    
    UITextField *           m_ccSendTF;               //抄送者编辑框
    UITextField *           m_toSendTF;               //发送人编辑框
	UITextField *           m_subjectTF;
	
	UIView *                m_toContainerView;        //收件人
    UIView *                m_ccContainerView;        //抄送
	UIView *                m_contentContainerView;   //内容
	UIView *                m_subjectContainerView;   //主题
    UIView *                m_butContainerView;       //存放button的view
	
	NSTimer     *           m_tipTimer;
	UIAlertView *           m_tipAlert;
	
	NSMutableArray *        m_totalAddrArray;       //保存发送和抄送人的地址。
    NSMutableArray *        m_sendAddrArray;        //保存所有发送邮件人的地址
    NSMutableArray *        m_ccAddrArray;          //保存所有草送人的的地址
    //NSMutableArray *      ccArray;                //保存抄送邮件列表信息receiverid
	
	NSInteger               m_receiverRowIndex;
	NSInteger               m_indexOfFirstNewLine;
    
    NSInteger               m_ccReceiverRowIndex;     //抄送者行数
	NSInteger               m_ccIndexOfFirstNewLine;
	
	NSDictionary *          m_receiverObj;  
	BOOL                    m_offsetFlag;
	MailFriendList*         m_friC;
    MailCCFriendList*       m_mailCCfri;
	CGRect                  m_rect;
    
    UIButton*               m_sendBut;
    UIButton*               m_saveBut;
    MailDetailMessage*      m_mailDetailMessage;    //邮件详细页面的指针
    NSMutableString *       m_mailContent;          //保存邮件内容
    UIView*                 m_mailContenView;       //存放邮件信息的cell
    UITableViewCell*        m_mailCellView;  //
    MailComposeType         m_mailComType;          //mail 撰写类型
}
@property(nonatomic) CGRect                             m_rect;
@property (nonatomic, retain) IBOutlet UINavigationBar* m_navBar;
@property (nonatomic, retain) MailDetailMessage*        m_mailDetailMessage;
@property(nonatomic,assign) MailComposeType             m_mailComType;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil receiverObj:(NSDictionary*)rec;

-(IBAction)onSend:(id)sender;
-(IBAction)onCancel:(id)sender;
-(IBAction)onSave:(id)sender;

-(IBAction)dismissKeyBoard:(id)sender;

-(void)callFriendList:(id)sender;

-(void)callCCFriendList:(id)sender;

// 得到当前时间
- (NSString *)getCurrentTime;

//增加发送邮件列表
-(BOOL)addReceiver:(id)recObj;

//增加抄送接受者
-(BOOL)addCCReceiver:(id)recObj;

-(void)refreshReceiverView:(int)flag;

//抄送邮件列表
-(void)refreshCCReceiverView:(int)flag;

-(void)dismissTipAlert:(NSTimer*)ti;

-(void)onNavigation;

//去掉 < > 提取邮件地址
-(NSString*) getMailAddress:(NSString*) originMailAddr;

/*
 存放邮件详细页面的指针
 */

-(void)setMailDetailObj:(MailDetailMessage*)mailComposer;

-(NSString*)getMailShareParentId;

@end
